<template>
  <!-- 订单超时 1 支付成功2  订单异常3 等待支付0 -->
  <div class="main">
    <div class="main_cart">我的订单</div>
    <div v-loading="loading">
      <el-card class="box-card" v-for="(item, index) in totalCard" :key="index">
        <div class="order_content">
          <img :src="item.cover_show" alt="" v-if="item != null" />

          <div class="content" v-if="item != null">
            <div class="title">{{ item.title }}</div>
            <div class="detail">
              <div>订购座位：{{ item.seat }}</div>
              <div class="time">下单时间：</div>
              <div class="time_content" style="color: aaa; width: 200px">
                <!-- v-if="item.status === 2" -->
                {{ item.times }}-{{ item.starTime }}
              </div>
            </div>
          </div>

          <div class="price" style="color: black; font-size: 18px">
            ￥{{ item.price }}
          </div>
          <el-button
            type="text"
            class="first"
            style="color: blue"
            v-if="item.status === 0"
            @click="handlePay(item, index)"
            >等待支付
          </el-button>
          <el-tooltip
            class="item"
            effect="dark"
            content="请联系工作人员"
            placement="top"
            ><div v-if="item.status === 3" style="color: red" class="first">
              订单异常
            </div>
          </el-tooltip>
          <div v-if="item.status === 2" style="color: green" class="first">
            支付成功
          </div>
          <div v-if="item.status === 1" style="color: red" class="first">
            订单超时
          </div>
        </div>
      </el-card>
    </div>

    <el-dialog
      title="扫码支付"
      :visible.sync="dialogVisible"
      width="21%"
      :show-close="false"
    >
      <div>
        <img src="../../assets/img/c.jpeg" alt="" class="c-img" />
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitPay">支付成功</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dialogVisible: false,

      loading: false,

      totalCard: [
        {
          status: 3,
          title: "《小小愿望》",
          seat: "22号",
          times: "2021-12-09",
          starTime: "18:00",
          price: 30,
          cover_show: require("../../assets/filmImg/xxyw.jpg"),
        },

        {
          status: 2,
          title: "《小小愿望》",
          seat: "22号",
          times: "2021-12-09",
          starTime: "18:00",
          price: 30,
          cover_show: require("../../assets/filmImg/xxyw.jpg"),
        },

        {
          status: 0,
          title: "《小小愿望》",
          seat: "22号",
          times: "2021-12-09",
          starTime: "18:00",
          price: 30,
          cover_show: require("../../assets/filmImg/xxyw.jpg"),
        },
      ],
    };
  },
  methods: {
    handlePay(order, index) {
      this.open(order, index);
    },
    open(order, index) {
      this.$confirm("请您仔细确认订单金额为" + order.price + "元，是否继续？", {
        confirmButtonText: "确认支付",
        cancelButtonText: "取消支付",
        type: "success",
        center: true,
      })
        .then(() => {
          // this.loading = true;
          this.dialogVisible = true;
          this.payOrderId = order.id;
        })
        .catch(() => {
          this.$message({
            type: "warning",
            message: "用户已取消支付,请您前往我的订单进行支付",
          });
        });
    },
    submitPay() {
      this.dialogVisible = false;
    },
  },
  //支付成功按钮
};
</script>

<style lang="scss" scoped>
.main {
  .main_cart {
    width: 100%;
    height: 90px;
    // background: pink;
    line-height: 90px;
    font-size: 20px;
    padding-left: 30px;
  }
  .box-card {
    width: 700px;
    height: 175px;
    // background: yellow;
    margin-left: 50px;
    margin-top: 20px;
    .order_content img {
      width: 100px;
      height: 130px;
      float: left;
    }
    .content {
      float: left;
      .title {
        font-size: 20px;
        font-weight: bold;
        padding-left: 30px;
      }
      .detail {
        color: #aaa;
        font-size: 13px;
        padding-left: 40px;
        div {
          margin-top: 25px;
        }
        .time {
          float: left;
          // background: red;
          .time_content {
            float: left;
          }
        }
      }
    }
    .price {
      float: left;
      width: 50px;
      height: 50px;
      // background: blue;
      margin-top: 40px;
      margin-left: 150px;
      line-height: 50px;
      // color: white;
    }
    .first {
      width: 75px;
      height: 50px;
      font-size: 18px;
      line-height: 50px;
      margin-right: 20px;
      margin-top: 40px;

      // background: pink;

      float: right;
    }
  }
  .el-dialog img {
    width: 285px;
    height: 285px;
  }
}
</style>